//
//  main.m
//  lesson one
//
//  Created by huanghui on 16/6/13.
//  Copyright © 2016年 huanghui. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Animal.h"
#import "Person.h"
#import "Mouse.h"
#import "Restorant.h"
#import "Manager.h"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        NSLog(@"Hello, World!");
        Animal *ani = [[Animal alloc] init];
        ani.name = @"我是动物类";
        [ani compare:ani];
        
        Person *p = [[Person alloc] init];
        p.name = @"陈泽";
        
        Mouse *m = [[Mouse alloc] init];
        m.name = @"米老鼠";
        [m makeRole];
        [m eat];
        [m sleep];
        
        NSArray *arr = @[ani, p, m];
        NSLog(@"names: %@", [arr componentsJoinedByString:@","]);
        
        NSString *str = @"a,d,c,b";
        NSArray *ano = [str componentsSeparatedByString:@","];
        ano = [ano sortedArrayUsingSelector:@selector(compare:)];
        for (int i = 0; i < ano.count; i++) {
            NSString *s = ano[i];
            NSLog(@"%d、%@", i, s);
        }
        NSString *st = @"1,2,3,4";
        //NSArray  *numbers = [st componentsSeparatedByString:@","];
        
      NSArray *numbers = [[NSArray alloc]initWithObjects:@"1",@"2",@"3",@"4", nil];        numbers = [numbers sortedArrayUsingSelector:@selector(compare:)];
       for (int i = 0; i < numbers.count; i++) {
            NSNumber *s = numbers[i];
           NSLog(@"%d、%@", i, s);}
        
        NSMutableArray *abc = [[NSMutableArray alloc]initWithCapacity:1];
        for(int i=0;i<10;i++)
        {
                [abc addObject:@"hehe"];
           
        }
            for(int i=0;i < abc.count;i++)
        {
            int l = i;
            NSString *a = abc[i];
            NSLog(@"%d:%@",l,a);
            
        
        }

            Restorant *resto =[Restorant alloc];
            Customer *cust = [Customer alloc];
            cust.delegete = resto;
            [cust comeToRestorant];
            Login *log = [Login alloc];
            Manager *man = [Manager alloc];
            log.delegete = man;
            [log getName];
            
        }
        
    
    return 0;
}
